<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 * 
 */
  function unique_salt()
        {

            return substr(md5(mt_rand()), 0, 22);
        }
session_start();

include_once("../libs/setup.php");
include_once("../libs/helper.php");

$password = substr(md5(mt_rand() . mt_rand() . mt_rand()), 0, 8);
$unique_salt = unique_salt();
$hash = md5($unique_salt . $password);

$email = 'admin@vinastemcelllab.com';
$ho_ten = 'Admin';
$sql = "insert into `user` (`Role`,`Email`,`Password`,`PassSalt`,`HoTen`,`KichHoat`) values('admin','{$email}','{$hash}'
            ,'{$unique_salt}','{$ho_ten}',1 )";
$mysqli = connect_database($smarty);
$result = $mysqli->query($sql);
if ($result) {
    $smarty->assign('wwwUrl','..') ;
    $smarty->assign('title', 'Tạo tài khoản thành công');
     $smarty->assign('message', 'Mật khẩu là'. $password);
     $smarty->assign('message_class', 'success');
     $smarty->display('notification.tpl');
}

